Skip to content

Fix hotkey display for non-US keyboard layouts (§/± key)#258

Open
shhac wants to merge 4 commits intoaltic-dev:mainfrom
shhac:paul/fix-hotkey-display-section-key
Open

Fix hotkey display for non-US keyboard layouts (§/± key)#258
shhac wants to merge 4 commits intoaltic-dev:mainfrom
shhac:paul/fix-hotkey-display-section-key

Conversation

@shhac
Copy link
Copy Markdown

@shhac shhac commented Apr 6, 2026

Summary

Fixes #126

On non-US keyboards (e.g. British, German, French), some keys produce different characters than on a US layout. The hotkey display was using a hardcoded lookup table that mapped physical key codes to US keyboard characters — so key code 10 (the ISO key between Escape and Tab) was missing entirely, and punctuation keys like [, ;, ' would show their US characters even on layouts where those keys produce ü, ö, ä, etc.

The broken fallback for unmapped keys converted the raw key code number to a Unicode character — key code 10 becomes U+000A (line feed), which is invisible. That's why the UI showed an empty box.

This PR replaces the hardcoded character table with a layout-aware lookup (UCKeyTranslate) that asks macOS what character each key actually produces on the user's current keyboard layout. The hardcoded table is kept only for keys with semantic names (Return, Tab, Space, Delete, Escape, arrow keys, modifiers) where the name is more useful than the character.

A US QWERTY fallback map is retained for edge cases where TIS layout data is unavailable (e.g. emoji or CJK input sources), so labels degrade gracefully rather than showing ? for every key.

Test plan

  • On a British keyboard layout, assign § (or ⇧ + § for ±) as a hotkey — verify it renders correctly
  • On a US keyboard layout, verify all existing hotkeys still display correctly
  • Check hotkey display in: Settings, recording overlay, menu bar, and welcome screen
  • Verify the hotkey still triggers correctly after reassignment
  • If possible, test with a non-QWERTY layout (e.g. German QWERTZ) — punctuation keys should show their actual characters

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 154e4a5692

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4b597ad678

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@altic-dev
Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@altic-dev
Copy link
Copy Markdown
Owner

if you can show me a video of before and after and take care of Codex reviews, we can try to sort this out soon! Thanks man

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🐞 BUG] keyboard shortcut UI doesn't render §/± key

2 participants